package com.blensmile.entities;

import android.os.Parcel;
import android.os.Parcelable;

import com.blensmile.utils.LogUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Blensmile on 2016/12/29.
 */

public class MediaTestBean implements Parcelable{

    public static final int TYPE_OFFICIAL = 0x11;
    public static final int TYPE_USER = 0x22;
    public static final int TYPE_REPLY = 0x33;

    private String url = "";
    private int time = 0;
    private int type  = 0;//声音来源

    protected MediaTestBean(Parcel in) {
//        url = in.readString();
        time = in.readInt();
        type = in.readInt();
    }

    public static final Creator<MediaTestBean> CREATOR = new Creator<MediaTestBean>() {
        @Override
        public MediaTestBean createFromParcel(Parcel in) {
            return new MediaTestBean(in);
        }

        @Override
        public MediaTestBean[] newArray(int size) {
            return new MediaTestBean[size];
        }
    };

    public String getType() {
        String str;
        switch (type){
            default:
            case TYPE_OFFICIAL:
                str = "offical";
                break;
            case TYPE_REPLY:
                str = "reply";
                break;
            case TYPE_USER:
                str = "user";
                break;
        }
        return str;
    }

    public MediaTestBean(int type,int time,String url) {
//        this.url = url;
        this.time = time;
        this.type = type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
//        dest.writeString(url);
        dest.writeInt(time);
        dest.writeInt(type);
    }

//    @Override
//    protected void finalize(){
//        LogUtils.b("id:"+hashCode()+" finalized");
//    }
}
